import httpInstance from "@/utils/http";

export function addDocumentApi(document) {
    return httpInstance({
        url: "/document/add",
        method: "put",
        data: document
    })
}

export function editDocumentApi(document) {
    return httpInstance({
        url: "/document/update",
        method: "post",
        data: document
    })
}

// 获取编号为doi的一个完整的文档
export function searchByDoi(doi) {
    return httpInstance({
        url: "/document/searchByDoi?doi=" + encodeURIComponent(doi),
        method: "get",
    })
}

export function getPageApi(page, size, flag, key) {
    return httpInstance({
        url: "/document/get/" + page + '/' + size + '?flag=' + flag + '&key=' + encodeURIComponent(key),
        method: "get",
    })
}


export function reInitDocById(id) {
    return httpInstance({
        url: "/document/reInitDocById/" + id,
        method: "post",
    })
}

export function getDocById(id) {
    return httpInstance({
        url: "/document/getById/" + id,
        method: "get",
    })
}
